package pers.zb.cloud.web.upms.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import pers.zb.cloud.web.upms.entity.ClientDetail;
import pers.zb.cloud.web.upms.service.hystrix.ClientDetailServiceHystrix;
import pers.zb.cloud.web.upms.vo.ClientVo;
import pers.zb.cloud.web.upms.vo.Page;

import java.util.List;

@FeignClient(value = "sea-cloud-service-upms", fallback = ClientDetailServiceHystrix.class)
public interface ClientDetailService {

    /**
     * 根据应用ID获取应用信息
     */
    @RequestMapping(value = "/upms/service/client/{clientId}",method = RequestMethod.GET)
    ClientDetail getClientDetailByClientId(@PathVariable("clientId") String clientId);

    /**
     * 分页获取客户端列表
     *
     * @param pageParam 分页参数
     */
    @RequestMapping(value = "/upms/service/client/list/page",method = RequestMethod.POST)
    Page<ClientDetail> getClientListForPage(@RequestBody Page pageParam);

    /**
     * 更新或者添加应用
     */
    @RequestMapping(value = "/upms/service/client/{type}",method = RequestMethod.POST)
    void updateOrSave(@PathVariable("type") int type, @RequestBody ClientDetail clientDetail) throws Exception;

    /**
     * 批量删除应用
     */
    @RequestMapping(value = "/upms/service/client/delete/batch",method = RequestMethod.POST)
    void deleteClient(@RequestParam("clientId") String[] clientIdArrs) throws Exception;

    /**
     * 获取应用列表 - 左侧tree
     */
    @RequestMapping(value = "/upms/service/menu/client/tree/list",method = RequestMethod.GET)
    List<ClientVo> getClientListTree();

    /**
     * 获取所有应用列表
     */
    @RequestMapping(value = "/upms/service/client/list/all",method = RequestMethod.GET)
    List<ClientDetail> selectAllClientDetailList();
}
